<template>
	<view class="content">
		<TopLogo></TopLogo>
		<view class="form-content-wrap">
			<view class="content-box">
				<view class="form-content">
					<img src="../../static/my-code.png" class="my-title-icon"></img>
					<img src="../../static/sub_title.png" class="my-sub-title-icon"></img>
					<view class="my-code-box">
						<img :src="userData.qrCode" class="qr"></img>
					</view>
					<img src="../../static/qd_text.png" class="tips-icon"></img>
					<!-- <img src="../../static/tv.png" class="tv-icon"></img>
					<img src="../../static/good-house.png" class="good-house-icon"></img> -->
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import TopLogo from '@/components/topLogo/index.vue';
	export default {
		components: {
			TopLogo
		},
		data() {
			return {
				userData: {}
			}
		},
		onLoad() {
			this.getInfo()
		},
		methods: {
			getInfo() {
				// 网络请求
				uni.showLoading({
					title: '请求中',
				});
				uni.request({
					url: 'https://dy.btvs.cn/api/basic/guest/getInfo',
					method: 'GET',
					header: {
						Authorization: uni.getStorageSync('token')
					},
					dataType: 'json',
					success: (res) => {
						uni.hideLoading();
						if (res.data.code == 200) {
							this.userData = {
								...res.data.data
							}


						} else {
							uni.showToast({
								title: res.data.msg,
								icon: "error"
							})
							if (res.data.code == 401) {
								setTimeout(() => {
									uni.navigateTo({
										url: '/pages/index/index'
									})
								}, 1500)
							}
						}
					},
					fail: () => {
						uni.hideLoading();
						uni.showToast({
							title: '网络开小差了~',
							icon: "error"
						})
					},
				});
			},
			handleBack() {
				uni.navigateBack()
			}
		}
	}
</script>

<style lang="less">
	.content {
		height: 100vh;
		background: url('../../static/form_bg3.png');
		background-size: 100% 100%;
		background-repeat: no-repeat;
		background-position: center;

		.form-content-wrap {
			width: 100%;
			height: 100%;
			// background: url('../../static/form_bg.png');
			// background-size: 85% auto;
			// background-repeat: no-repeat;
			// background-position: center;



			.content-box {
				width: 100%;
				height: 100%;
				// background: url('../../static/wl_bg.png');
				// background-size: 100% 100%;
				// background-repeat: no-repeat;
				// background-position: center;
				display: flex;
				align-items: center;
				justify-content: center;
				flex-direction: row;
			}


			.form-content {
				width: 80%;
				padding: 80rpx;
				margin: 0 auto;
				position: relative;
				text-align: center;

				.my-title-icon {
					width: 75%;
				}

				.my-sub-title-icon {
					margin-top: 20rpx;
					width: 45%;
				}

				.my-code-box {
					padding: 30rpx;
					width: 300rpx;
					height: 300rpx;
					margin: 20rpx auto;
					background: url('../../static/code_bg.png');
					background-size: 100%;
					background-repeat: no-repeat;
					background-position: center;
					.qr{
						max-width: 100%;
						display: block;
						border-radius: 10rpx;
					}
				}

				.tips-icon {
					width: 85%;
				}

				.good-house-icon {
					position: absolute;
					width: 260rpx;
					right: -80rpx;
					bottom: -80rpx;
				}

				.tv-icon {
					position: absolute;
					width: 200rpx;
					left: -70rpx;
					bottom: -80rpx;
				}
			}


		}

	}
</style>